load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")
load("@fbsource//tools/build_defs:rust_unittest.bzl", "rust_unittest")

oncall("scm_server_infra")

rust_library(
    name = "repo_event_publisher",
    srcs = glob(["src/**/*.rs"]),
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:serde_json",
        "fbsource//third-party/rust:tokio",
        "//common/rust/shed/facet:facet",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
    ] + ([] if rust_oss.is_oss_build() else [
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/stats:stats",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/scribe/api:scribe_api",
        "//common/rust/shed/cloned:cloned",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:dashmap",
        "fbcode//dsi/logger/thrift_schemas/mononoke_git_content_ref:mononoke_git_content_ref_logger_schema-rust",
        "fbcode//dsi/logger/thrift_schemas/mononoke_bookmark:mononoke_bookmark_logger_schema-rust",
        "fbcode//dsi/logger/rust/deserializer:deserializer",
    ]),
)

rust_unittest(
    name = "repo_event_publisher_test",
    srcs = glob(["test/**/*.rs"]),
    crate = "repo_event_publisher_test",
    deps = ([] if rust_oss.is_oss_build() else [
        ":repo_event_publisher",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
        "fbsource//third-party/rust:anyhow",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//common/rust/scribe/api:scribe_api",
    ]),
)
